# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Alexander Fehr <pizzapunk gmail com>
# Contributor: Link Dupont <link@subpop.net>

pkgname=mpc
pkgver=0.33
pkgrel=3
pkgdesc="Minimalist command line interface to MPD"
url="https://www.musicpd.org/clients/mpc/"
license=('GPL2')
arch=('x86_64')
depends=('glibc')
makedepends=('libmpdclient' 'meson' 'python-sphinx')
options=('!emptydirs')
source=("https://www.musicpd.org/download/${pkgname}/${pkgver%.*}/${pkgname}-${pkgver}.tar.xz"{,.sig})
sha512sums=('d3247dfb54ac3c95caf5666088968a952b33eb7e8f941bca4f3715603839cf5a1bc5300488c78fdce6e38f612b243f2252ea682b8d0fec9f230acd760bf3560c'
            'SKIP')
b2sums=('220848e088964297fbaddeedf61d5ddc90386df360a6af81b2d3753517f7ee36ff3d9462242f38b17c991996927a7d1fc253e1006253f2f875023ddb75a800c2'
        'SKIP')
validpgpkeys=('0392335A78083894A4301C43236E8A58C6DB4512') # Max Kellermann <max@blarg.de>


build() {
  cd "${pkgname}-${pkgver}"
  meson --prefix /usr \
        --libexecdir lib \
        --sbindir bin \
        --buildtype plain \
        --auto-features enabled \
        --wrap-mode nodownload \
        -D b_lto=true \
        -D b_pie=true \
        build
  ninja -C build
}

package() {
  depends+=('libmpdclient.so')
  cd "${pkgname}-${pkgver}"
  DESTDIR="${pkgdir}" ninja -C build install
  install -vDm 644 contrib/mpc-completion.bash \
    "${pkgdir}/usr/share/bash-completion/completions/mpc"
  # the html documentation is not reproducible and only the man page is needed
  rm -rvf "${pkgdir}/usr/share/doc/${pkgname}/html"
}
